import { toJS } from 'mobx';
import { requiredPngImg } from '.';
export default class WeaInputCellType extends window.GC.Spread.Sheets.CellTypes.Text {
    typeName = 'WeaInputCellType';
    fieldType;
    viewAttr =2;
    label;
    expandType;
    combineSameCell;

    paint(ctx, value, x, y, w, h, style, context) {
        if (!ctx) {
            return;
        }
        super.paint(ctx, value, x, y, w, h, style, context);
        if (this.viewAttr == 3) {
            if (value || value === 0) {
            } else {
                ctx.drawImage(requiredPngImg, x + w - 8, y + (h - 7) / 2, 7, 7);
            }

        }

    }

    fromJSON(setting) {
        this.fieldType = toJS(setting.fieldType)
        this.viewAttr = setting.viewAttr;
        this.label = setting.label;
        this.expandType = setting.expandType;
        this.combineSameCell = setting.combineSameCell;
    }

    toJSON = (setting) => {
        let res =  super.toJSON();
        res.viewAttr = this.viewAttr;
        res.label = this.label;
        res.expandType = this.expandType;
        res.fieldType = this.fieldType;
        res.combineSameCell = this.combineSameCell;
        return res;
     }
    doUpdateValue = () => {

    }
}